#include"LightDirectional.h"

DirectionalLight::DirectionalLight()
{
}

DirectionalLight::~DirectionalLight()
{
}

void DirectionalLight::Update()
{
	m_shader->SetParameterStateMatrix( "ProjI", CG_GL_PROJECTION_MATRIX, CG_GL_MATRIX_INVERSE_TRANSPOSE );
	m_shader->SetParameter4f( "lightColor", m_color );
	m_shader->SetParameter4f( "lightDir", m_direction );
	m_shader->SetParameter1f( "lightPower", m_power );
}

void DirectionalLight::Render()
{
	m_shader->Use(true);
	glBegin(GL_QUADS);
		glTexCoord2f(0, 0);glVertex3f(-1,-1, .5f);
		glTexCoord2f(1, 0);glVertex3f(1,-1, .5f);
		glTexCoord2f(1, 1);glVertex3f(1, 1, .5f);
		glTexCoord2f(0, 1);glVertex3f(-1, 1, .5f);
	glEnd();
	m_shader->Use(false);
}